from tkinter import Tk from tkinter.filedialog import askopenfilename Tk().withdraw() # we don't want a full GUI, so keep the root window from appearing filelocation = askopenfilename() # open the dialog GUI